package Day2025_04_14;

import java.util.Scanner;

public class Demo03 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        while (t-- != 0) {
            int n = in.nextInt();
            in.nextLine();
            String[] ss = new String[n];
            for (int i = 0; i < n; i++) {
                ss[i] = in.nextLine();
            }
            boolean[] flag = new boolean[n / 2];
            for (int i = 0; i < n / 2; i++) {
                int[] hash = new int[26];
                for (int j = 0; j < ss[i].length(); j++) {
                    int s = ss[i].charAt(j) - 'a';
                    if (hash[s] == 0) hash[s]++;
                }
                for (int j = 0; j < ss[n - i - 1].length(); j++) {
                    int s = ss[n - i - 1].charAt(j) - 'a';
                    if (hash[s] != 0) {
                        flag[i] = true;
                        break;
                    }
                }
            }
            boolean tmp = true;
            for (int i = 0; i < n / 2; i++) {
                tmp = tmp && flag[i];
            }
            if (tmp) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}
